package online_exams.service.impl;

import cn.dev33.satoken.secure.BCrypt;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import online_exams.domain.TUserEntity;
import online_exams.mapper.TUserMapper;
import online_exams.service.TUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.List;

/**
 * 用户信息表(TUser)表服务实现类
 *
 * @author makejava
 */
@Service
public class TUserServiceImpl implements TUserService {


    @Autowired
    private TUserMapper tUserMapper;

    @Override
    public Object getById(Serializable id) {
        return null;
    }

    @Override
    public Object save(TUserEntity tUserEntity) {
        return null;
    }

    @Override
    public Object updateById(TUserEntity tUserEntity) {
        return null;
    }

    @Override
    public Object removeByIds(List<Long> idList) {
        return null;
    }

    //登录
    @Override
    public TUserEntity login(TUserEntity userEntity) {
        return tUserMapper.login(userEntity);

    }

    //新增
    @Override
    public Integer studentinsert(TUserEntity tUserEntity) {
        tUserEntity.setPassword(BCrypt.hashpw(tUserEntity.getPassword(), BCrypt.gensalt(15)));
        return tUserMapper.studentinsert(tUserEntity);

    }

    @Override
    public TUserEntity GetStudentId(String studentId) {
        return tUserMapper.GetStudentId(studentId);

    }

    @Override
    public TUserEntity GetUserInfo(Object loginId) {
        return tUserMapper.getUserInfo(loginId);

    }
}

